package cn.coderliu.voteweb.common.base;



import cn.coderliu.voteweb.common.resultEntity.SearchResult;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2014/12/29.
 */
public interface BaseService<T> {
    List<T> findAll();

    T get(Object id);

    T save(T entity);

    void delete(Long id);

    <T> void delete(T entity);

    T update(T entity);

    List<T> findList(String jql);

    List<T> findByList(String jql, Map<String, Object> parameter);

    SearchResult<T> findByPage(String jql, Integer pageNo);

    SearchResult<T> findByPage(String jql, Integer pageNo, Integer pageSize);

    SearchResult<T> findByPage(String jql, Integer pageNo, Integer pageSize, Map<String, Object> parameter);

    int batchUpdate(String jpql, Object... params);

    void batchInsert(List<T> items);

    void batchUpdate(List<T> items);

    List<T> jpqlSearch(String jql, Object... params);

    Map<String, Object> searchListMapByPage(String sql, int pageNo, int pageSize);

    Map<String, Object> listToJson(List<Map<String, Object>> mapList, Integer pageIndex, Integer pageSize);

    SearchResult<T> entityListByPage(List<T> list, Integer pageNo, Integer pageSize, Map<String, Object> parameter);
}
